<div id="contact-form" class="form-area">
    <form action="/resume/basic/edit" method="post" id="form-contact">
        <input type="hidden" name="method" value="do"/>
        <input type="hidden" name="CSRFToken" value="${CSRFToken!}"/>
        <input type="hidden" name="type" value="contact">
        <table width="100%" class="dj-form-base copy">
            <colgroup>
                <col width="180">
                <col width="*">
            </colgroup>
            <tbody>
            <tr>
                <th><em>*</em>邮箱:</th>
                <td class="input">
                    <input type="text" reg="email" class="text J_checkContact" name="email" maxlength="50" value="${(basic.email)!}"
                           id="emailInput">
                    <em class="sync"></em>

                    <div style="display: none; " class="error"> 请输入正确的电子邮件</div>
                </td>
            </tr>
            <tr>
                <th>电话:</th>
                <td class="input">
                    <input type="text" id="telZipcode" blankclass="g6" blankvalue="国内区号" blanksubmit="true" class="text J_checkContact g" maxlength="4" reg="fun:ziptest" name="telZipcode" value="${(basic.telZipcode)!}" style="width:50px;"> -
                    <input type="text" id="telephone" class="text J_checkContact" blankclass="g6" blanksubmit="true" blankvalue="电话号码" maxlength="10" reg="fun:teltest" maxlength="8" name="tel" value="${(basic.tel)!}" style="width:154px;">
                    <em class="sync"></em>
                    <div style="display: none; " class="error">请输入3-4位国内区号和4-10位电话号码</div>
                </td>
            </tr>
            <tr>
                <th>QQ:</th>
                <td class="input">
                    <input type="text" reg="numeric" class="text J_checkContact" maxlength="50" name="qq" value="${(basic.qq)!}" blanksubmit="true"                            >
                    <em class="sync"></em>

                    <div style="display: none; " class="error"> 请输入正确QQ号</div>
                </td>
            </tr>
            <tr>
                <th>MSN:</th>
                <td class="input">
                    <input type="text" reg="email" class="text J_checkContact" name="msn" value="${(basic.msn)!}" blanksubmit="true"                            >
                    <em class="sync"></em>

                    <div style="display: none; " class="error"> 请输入正确的MSN</div>
                </td>
            </tr>
            
            <tr>
                <th>&nbsp;</th>
                <td class="input button">
                    <a href="javascript:void(0);" class="fresh formValidateSubmit margin"
                       id="J_contactSubmit" itemtype="contact"><span>保存</span></a><a href="javascript:void(0);" class="normal J_cancel" itemtype="contact"><span>取消</span></a>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
    <script type="text/javascript">
        $(function () {
            var $checks = $('.J_checkContact'),
                    $btnO = $('#J_contactSubmit'),
                    flag = true;
            $checks.formValidate();
            $checks.focus(function () {
                $(this).parents('td.input').find('.error').hide();
            });
            $('.text').focus(function () {
                $(this).parents('td.input').find('.error').hide();
            });

            $btnO.click(function (e) {
                e.preventDefault();
                var itemType = $(this).attr('itemtype');
                $checks.each(function () {
                    var e = $.formValidate.check(this);
                    if (!e) {
                        $(this).parents('td.input').find('.error').show();
                    }
                });
                if ($.formValidate.check()) {
                    $checks.each(function(){
                        var $this = $(this);
                        var bv = $this.attr('blankvalue');
                        if(bv && bv == $this.val()){
                            $this.val('');
                        }
                    });
                    formSubmit($('#form-contact'),itemType)
                }
            });
        });
        function _GapCheck() {
            var val = $(this).val()
            if (/^[0-5]+(\.\d{1,2})?$/.test(val)) {
                return val <= 5
            }
        }

        $(function(){
            window['G_ValidatePhone'] && G_ValidatePhone.prototype.destroy();
            var $mobile = $('#mobile');
            var $code = $('#mobileZipcode');
            var $auth = $('#mobile-auth');
            var auth = $auth.val();
            var validatePhone = new G_ValidatePhone({
                type : 'job',
                token : '',
                num_self : 'e' + '',
                callback : function(args){
                    var phoneNum = args.phoneNum;
                    var status = args.status; // 0成功 , 1失败
                    if(status == 0){
                        $mobile.val(phoneNum);
                        $auth.val(phoneNum);
                        auth = phoneNum;
                    }
                }
            });
            $code.blur(function(){
                $mobile.blur();
            });
            $mobile.bind('blur', function(){
                var val = $mobile.val();
                if($.formValidate.check('basicValidate',$mobile[0]) && val != auth && $code.val() == '0086'){
                    validatePhone.openDialog(val);
                }
            });
        })
    </script>
</div>